<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../../js/boot.js"></script>
</head>

<body>
    <div id="container">
        <div id="formcontainer">
            <form class="layui-form layui-form-pane" id="editform" lay-filter="editform">
                <div class="layui-row">
                    <div class="layui-col-xs12">
                        <div class="layui-form-item">
                            <label class="layui-form-label required">原密码</label>
                            <div class="layui-input-block">
                                <input type="password" name="oldpassword" autocomplete="off" class="layui-input required">
                            </div>
                        </div>
                    </div>
                    <div class="layui-row">
                        <div class="layui-col-xs12">
                            <div class="layui-form-item">
                                <label class="layui-form-label required">新密码</label>
                                <div class="layui-input-block">
                                    <input type="password" name="newpassword" id="newpassword" autocomplete="off" class="layui-input required">
                                </div>
                            </div>
                        </div>
                        <div class="layui-row">
                            <div class="layui-col-xs12">
                                <div class="layui-form-item">
                                    <label class="layui-form-label required">确认密码</label>
                                    <div class="layui-input-block">
                                        <input type="password" name="confirmnewpassword" id="confirmnewpassword" autocomplete="off" class="layui-input required">
                                    </div>
                                </div>
                            </div>
                </div>
            </form>
        </div>
        <div id="opcontainer">
            <button class="layui-btn" type="button" onclick="HandleSave()">确认</button>
            <button class="layui-btn layui-btn-primary" onclick="HandleClose()">关闭</button>
        </div>
    </div>
</body>
<script>
    $(function () {
     
    })

    function HandleSave() {
        SubmitForm('editform', 'system/org/user/changePassword', BeforeSubmit, null, function (result, status) {
            if (result.code == 0) {
                OpenSuccess('修改成功', function (params) {
                    CloseDialog();
                })
            } else {
                OpenFail(result.msg);
            }
        })
    }

    function BeforeSubmit(data) {
        if($("#newpassword").val()!=$("#confirmnewpassword").val()){
            OpenWarning("确认密码不一致");
            return false;
        }
        return true;
    }

    function HandleClose() {
        CloseDialog();
    }
</script>

</html>